import dateFormat from "./dateFormat";

export const getBase64 = (img:any, callback:any) => {
    const reader = new FileReader();
    reader.addEventListener('load', () => callback(reader.result));
    reader.readAsDataURL(img);
}

export function getThisWeekData() {//获得本周周一~周日的年月日  
    var lastweek = []
    var date = new Date();
    let lastweekone=date.setDate(date.getDate()-7 - date.getDay() + 1);
    for(let i=0;i<7;i++){
        console.log(lastweekone);
        
        lastweek.push(dateFormat(new Date(lastweekone).setDate(date.getDate()+i)).ymd)
    }
    return lastweek
  }
  